home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 031-040 / amok38 / coco / demo / errors.def < prev    next >
Encoding:
Modula Definition  |  1993-11-04  |  2.4 KB  |  64 lines

  1. (* Errors       General module to store error messages   Moe 21.03.84
  2.    ======       ======================================
  3. This module stores information about syntax errors and semantic errors.
  4. The information can either be retrieved afterwards or be printed
  5. automatically as simple error messages.
  6. Furthermore the module contains procedures to report compiler errors
  7. and implementation restrictions. These procedures cause a program stop.
  8. ----------------------------------------------------------------------*)
  9. DEFINITION MODULE Errors;
  10.  
  11. FROM FileSystem IMPORT File;
  12.  
  13. (*EXPORT QUALIFIED
  14.   CompErr, Errorptr, GetNextSemErr, GetNextSynErr, GetNumberOfErrors, 
  15.   PrintSemErrors, PrintSynErrors, Restriction, SemErr, SyntaxError;*)
  16.   
  17. TYPE
  18.   Symbolname = ARRAY[1..25] OF CHAR;
  19.   Errorptr   = POINTER TO Errornode;
  20.   Errornode  = RECORD   (*expected symbol in syntax error message*)
  21.     txt: Symbolname;
  22.     l: CARDINAL;
  23.     next: Errorptr;
  24.     END;
  25.     
  26.   
  27. PROCEDURE CompErr(nr:CARDINAL);
  28. (* Reports compiler error nr and stops the program*)
  29.  
  30. PROCEDURE GetNextSemErr(VAR nr,line,col:CARDINAL);
  31. (* Gets the error number, the line number and the column number of the 
  32.    next semantic error. nr=0 if no next error exists*)
  33.    
  34. PROCEDURE GetNextSynErr(VAR symbols:Errorptr; VAR line,col:CARDINAL);
  35. (* Gets the expected symbols, the line number and the column number of
  36.    the next syntax error. symbols=NIL if no next error exists*)
  37.    
  38. PROCEDURE GetNumberOfErrors(VAR synerrors,semerrors:CARDINAL);
  39. (* Gets the total number of syntax errors and semantic errors which
  40.    occured during compilation*)
  41.    
  42. PROCEDURE PrintSemErrors(VAR f:File; VAR semerrors:CARDINAL);
  43. (* Prints error messages for all stored semantic errors (line,col,
  44.    error number). semerrors holds the total number of stored semantic
  45.    errors*)
  46.    
  47. PROCEDURE PrintSynErrors(VAR f:File; VAR synerrors:CARDINAL);
  48. (* Prints error messages for all stored syntax errors (line,col,
  49.    "near symbol",expected symbols). synerrors holds the total number of 
  50.    stored syntax errors*)
  51.    
  52. PROCEDURE Restriction(nr:CARDINAL);
  53. (* Reports implementation restriction nr and stops the program*)
  54.  
  55. PROCEDURE SemErr(nr,line,col:CARDINAL);
  56. (* Stores the error number, line number and column number of a semantic
  57.    error*)
  58.    
  59. PROCEDURE SyntaxError(symbols:Errorptr; line,col:CARDINAL);
  60. (* Stores the "near-symbol", the expected symbols, the line number and 
  61.    the column number of a syntax error*)
  62.    
  63. END Errors.
  64.